//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Globalization;
using System.Windows.Data;
using OpenLS.Chart.UI.Internals;

namespace OpenLS.Chart.UI
{
    class MinMaxToStepConverter: IMultiValueConverter
    {
        public MinMaxToStepConverter(int maxItemCount)
        {
            this._maxItemCount = maxItemCount;
        }

        private readonly int _maxItemCount;
        #region IMultiValueConverter Members

        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            double min = (double)values[0];
            double max = (double)values[1];
            return AxisInfo.getStep(min, max, _maxItemCount);
        }




        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
